import { defineStore } from 'pinia'

export const useCanvasToolStore = defineStore('canvasTool', {
  state: () => ({
    toolBoxMenu: [
      {
        title: '基本对象',
        children: [
          {
            name: '发生器',
            type: 'produce',
            icon: 'nodeEnergy'
          },
          {
            name: '吸收器',
            type: 'absorb',
            icon: 'nodeRecycle'
          },
          {
            name: '缓冲区',
            type: 'buffer',
            icon: 'nodeBuffer'
          },
          {
            name: '加工站',
            type: 'process',
            icon: 'nodeMachine'
          },
          {
            name: '批处理',
            type: 'batchProcess',
            icon: 'nodeMachine'
          },
          {
            name: '装配站',
            type: 'assembly',
            icon: 'nodeMachine'
          },
          {
            name: '拆卸站',
            type: 'disassemble',
            icon: 'nodeMachine'
          }
        ]
      },
      {
        title: '物流设施',
        children: [
          {
            name: '传送带',
            type: 'belt',
            icon: 'nodeConveyor'
          },
          {
            name: 'AGV',
            type: 'AGV',
            icon: 'nodeAGV'
          },
          {
            name: '道路',
            type: 'road',
            icon: 'nodeRoad'
          },
          {
            name: '十字路',
            type: 'crossing',
            icon: 'nodeCrossing'
          }
        ]
      },
      {
        title: '资源',
        children: [
          {
            name: '工人池',
            type: 'workerPool',
            icon: 'nodeMasses'
          },
          {
            name: '区域',
            type: 'customArea',
            icon: 'nodeArea'
          },
          {
            name: '警戒线',
            type: 'warningLine',
            icon: 'nodeWarningLine'
          },
          {
            name: '文字',
            type: 'plaintext',
            icon: 'plaintext'
          },
          {
            name: '节点',
            type: 'customNode',
            icon: 'customNode'
          },
          {
            name: '连接线',
            type: 'customLink',
            icon: 'customNode'
          }
        ]
      }
    ],

    //当前选择的工具类
    currentToolCategory: '基本对象'
  }),
  actions: {
    // 切换工具类
    changeToolCategory(category: string) {
      this.currentToolCategory = category
    }
  }
})
